﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;

namespace Scada.DataApi.Rush
{
    class Program
    {
        static void Main(string[] args)
        {
            string address;
            int count = 0;
            if (args.Length > 0)
            {
                address = args[0];
            }
            else
            {
                address = "http://127.0.0.1:9999/Abc";
            }

            for (int i = 0; i < 200; ++i)
            {
                Thread thread = new Thread(new ThreadStart(()=>
                {
                    WebClient wc = new WebClient();

                    for (int j = 0; j < 20; j++)
                    {
                        string r = wc.DownloadString(address);
                        if (r.Contains("Abc"))
                            count++;
                        else
                            Console.WriteLine(r);
                    }
                }));
                thread.Start();

            }
            Thread.Sleep(4000);
            Console.WriteLine(count);
        }
    }
}
